Skip to content

Fix substring handling for non-BMP Unicode characters - #462

Open
sivaharish31 wants to merge 1 commit into
IBM:masterfrom
sivaharish31:fix/substring-non-bmp-461
Open

sivaharish31 wants to merge 1 commit into
IBM:masterfrom
sivaharish31:fix/substring-non-bmp-461

Conversation

@sivaharish31

Copy link
Copy Markdown

Fixes Unicode substring handling for non-BMP characters in $substring, $substringAfter, and $substringBefore.

Closes #461.

Changes

  • Updated JSONataUtils.substr() to consistently use Unicode code-point indexing.
  • Correctly convert code-point positions into UTF-16 offsets.
  • Clamp substring lengths to the remaining code points.
  • Removed duplicated substring helper implementations.
  • Added regression tests for supplementary Unicode characters and boundary conditions.

Testing

  • Focused substring tests: 134 passed.
  • Full Maven test suite: 1,223 passed, 0 failures, 0 errors, 93 skipped.
  • git diff --check: clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$substring throws IndexOutOfBoundsException on strings with non-BMP characters when length is omitted or too large

1 participant